﻿@model RTracker.Areas.Recruitment.Models.VacancySalary.GVacancySalary

@{
    ViewBag.ModuleName = "VacancySalary";
    ViewBag.bPagingEnabled = true;
    ViewBag.bSearchEnabled = true;
    ViewBag.bNewDeleteEnabled = true;
    ViewBag.bCopyPasteEnabled = false;
    ViewBag.bLockingEnabled = true;
    ViewBag.bCanCreate = true;
    ViewBag.bCanDelete = true;


    ViewData["SearchByText"] = new string[] { "Name", "Description", "Created on" };
    ViewData["SearchByValue"] = new string[] { "vacancy_salary_name", "vacancy_salary_desc", "create_timestamp" };


}


@* /** Grid List section Starts **/
    "gd-grid-div-width-cls" : Class Contains the width of Grid Section.
*@
<div class="gd-grid-div-width-cls" id="main-list-id">

    @*header for our grid*@
    <div class="portlet box light-grey">
        <div class="portlet-title">
            <div class="caption">
                <i class="fa fa-globe"></i>Vacancy Salary
            </div>
            <div class="tools">
                @*<a href="javascript:;" class="collapse">
                </a>*@
                <a class="reload cursor-pointer-cls">
                    <span style="color: #FFF;margin-left: -47px;">Reload</span>
                </a>
            </div>
        </div>


        @*body of our grid*@
        <div class="portlet-body">
            @Html.Partial("../GridView/_DynamicGrid", Model.Paging)
            <div class="table-scrollable">

                <table id="tbl-gd-main" class="table table-striped table-bordered table-hover" style="table-layout: fixed">

                    @*header for our grid*@
                    <tr id="grid-header-id">
                        <th class="grid-checkbox-td-cls">
                            <input class="chk-gd-header-cls" type="checkbox">
                        </th>

                        @* Hardlock Head *@
                        @if (ViewBag.bLockingEnabled == true)
                        {
                            <th class="grid-gb-chk-hdl-cls">

                            </th>
                        }

                        @*displaying header name for the OrganizationName*@

                        <th id="vacancy_salary_name" @if (@ViewBag.SortOn == "vacancy_salary_name") { if (@ViewBag.SortType == "asc") { <text> class="headerSortUp " </text>                              } else { <text> class="headerSortDown " </text>                              } } else { <text> class="grid-sort-cls  " </text>                              }>
                            @Html.DisplayNameFor(model => model.VacancySalary.VacancySalaryName)
                        </th>


                        @*displaying header description for the City*@
                        <th id="vacancy_salary_desc"
                            @if (@ViewBag.SortOn == "vacancy_salary_desc") { if (@ViewBag.SortType == "asc") { <text> class="headerSortUp  grid-gb-data-col-cls" </text>                          } else { <text> class="headerSortDown  grid-gb-data-col-cls" </text>                          } } else { <text> class="grid-sort-cls  grid-gb-data-col-cls" </text>                          }>
                            @Html.DisplayNameFor(model => model.VacancySalary.VacancySalaryDesc)
                        </th>

                        @*display header for the TeamColor*@
                        <th id="create_timestamp" @if (@ViewBag.SortOn == "create_timestamp") { if (@ViewBag.SortType == "asc") { <text> class="headerSortUp  grid-gb-data-col-cls" </text>                           } else { <text> class="headerSortDown  grid-gb-data-col-cls" </text>                           } } else { <text> class="grid-sort-cls  grid-gb-data-col-cls" </text>                            }>
                            @Html.DisplayNameFor(model => model.VacancySalary.CreateTimestamp)
                        </th>
                    </tr>

                    @*this loop checks each and every item of model and displays their name,description and TeamColor accordingly*@
                    @if (Model.lstVacancySalary != null)
                    {
                        if (Model.lstVacancySalary.Count > 0)
                        {

                            foreach (var item in Model.lstVacancySalary)
                            {
                                <tr id="tr-row-@item.VacancySalaryId" class="tr-gd-row-cls cursor-pointer-cls cursor-pointer-cls">
                                    @* Checkbox Section for rows to select the Row *@
                                    <td class="grid-checkbox-td-cls">
                                        <input type="checkbox" class="chk-gd-row-cls">
                                    </td>

                                    @* HardLock and SoftLock Spacing for Records *@
                                    @if (ViewBag.bLockingEnabled == true)
                                    {
                                        <td class="gd-td-default-lock-cls">

                                            @* Check for SoftLock *@
                                            @if (item.IsSoftLocked == true)
                                            {
                                                @* If SoftLock is applied by VacancySalary that is Logged in, then This Condition will satisfy *@
                                                if (item.SoftLockedBy == ViewBag.CurrentUser)
                                                {
                                                    <span class="gd-softlock-by-owner-cls" title="Currently viewed by you."></span>
                                                }
                                                @* If SoftLock is applied by another VacancySalary then the Logged in VacancySalary, then This Condition will satisfy *@
                                                else
                                                {
                                                    <span class="gd-softlock-img-cls" title="Currently viewed by @item.SoftLockedByName"></span>
                                                }

                                            }
                                            @* Check for HardLock *@
                                            else if (item.IsHardLocked == true)
                                            {
                                                @* If HardLock is applied by VacancySalary that is Logged in, then This Condition will satisfy *@
                                                if (item.HardLockedBy == ViewBag.CurrentUser)
                                                {
                                                    <span class="gd-hardlock-by-owner-cls" title="Locked by you."></span>
                                                }
                                                @* If HardLock is applied by another VacancySalary then the Logged in VacancySalary, then This Condition will satisfy *@
                                                else
                                                {
                                                    <span class="gd-hardlock-img-cls" title="Locked by @item.HardLockedByName"></span>
                                                }
                                            }
                                            @* Default Lock Class  *@
                                            else
                                            {
                                                <span class="gd-default-lock-cls"></span>
                                            }
                                        </td>
                                    }

                                    @*displaying name for the businesunitname*@
                                    <td class="  grid-gb-data-col-cls">
                                        @Html.DisplayFor(modelItem => item.VacancySalaryName)
                                    </td>



                                    @*displaying name for the BusinessUnitDescription*@
                                    <td class="grid-gb-data-col-cls">
                                        @Html.DisplayFor(modelItem => item.VacancySalaryDesc)
                                    </td>



                                    @*displaying name for the CreateTimestamp*@
                                    <td class="grid-gb-data-col-cls">
                                        @Html.DisplayFor(modelItem => item.CreateTimestamp)
                                    </td>
                                </tr>
                                <tr class="gb-hidden-cls detail-section" id="tr-row-detail-@item.VacancySalaryId" style="background-color:#D8E1E7">
                                    <td id="td-row-detail-@item.VacancySalaryId" class="detail-section-td-cls" colspan="5"></td>
                                </tr>
                            }
                        }
                    }

                </table>
            </div>
        </div>
    </div>
    @* /** Grid View Ends **/*@
</div>
@* /** Grid List section Ends **/ *@


<script>

    $(".gd-softlock-img-cls").each(function () {

        $(this).parent().parent().children().children(".chk-gd-row-cls").addClass("gd-disabled-cls").attr("disabled", true);

    });


    $(".gd-hardlock-img-cls").each(function () {
        $(this).parent().parent().children().children(".chk-gd-row-cls").addClass("gd-disabled-cls").attr("disabled", true);

    });
    var nCount = 0;
    $(".chk-gd-row-cls").each(function () {

        if (!$(this).hasClass("gd-disabled-cls")) {

            nCount = nCount + 1;
        }
    });
    if (nCount == 0) {
        $(".chk-gd-header-cls").addClass("gd-disabled-cls");
        $(".chk-gd-header-cls").attr("disabled", true);
    }


    $("#txtsearchvalue").val(nGBSearch);
    $("#selsearchon").val(nGBSearchOn);

</script>
